/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author JAVA
 */
@Entity
@Table(name = "ImageProperty")
@NamedQueries({
    @NamedQuery(name = "ImageProperty.findAll", query = "SELECT i FROM ImageProperty i"),
    @NamedQuery(name = "ImageProperty.findByImgId", query = "SELECT i FROM ImageProperty i WHERE i.imgId = :imgId"),
    @NamedQuery(name = "ImageProperty.findByImagePath", query = "SELECT i FROM ImageProperty i WHERE i.imagePath = :imagePath")})
public class ImageProperty implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "imgId")
    private Integer imgId;
    @Basic(optional = false)
    @Column(name = "imagePath")
    private String imagePath;
    @Lob
    @Column(name = "imageDescription")
    private String imageDescription;
    @JoinColumn(name = "propertyId", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Property property;

    public ImageProperty() {
    }

    public ImageProperty(Integer imgId) {
        this.imgId = imgId;
    }

    public ImageProperty(Integer imgId, String imagePath) {
        this.imgId = imgId;
        this.imagePath = imagePath;
    }

    public Integer getImgId() {
        return imgId;
    }

    public void setImgId(Integer imgId) {
        this.imgId = imgId;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public String getImageDescription() {
        return imageDescription;
    }

    public void setImageDescription(String imageDescription) {
        this.imageDescription = imageDescription;
    }

    public Property getProperty() {
        return property;
    }

    public void setProperty(Property property) {
        this.property = property;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (imgId != null ? imgId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ImageProperty)) {
            return false;
        }
        ImageProperty other = (ImageProperty) object;
        if ((this.imgId == null && other.imgId != null) || (this.imgId != null && !this.imgId.equals(other.imgId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.ImageProperty[imgId=" + imgId + "]";
    }

}
